import {Http} from "../utils/http";

class Renter extends Http {
    constructor(props) {
        super(props);
    }


    add(rents, housId, commId, rentStarttime, rentEndtime) {
        return this.request({
          url: "/mini/miniRent/add",
          method: "post",
          data: {
            rents,
            housId,
            commId,
            rentStarttime,
            rentEndtime,
          },
        });
    }

    list(pageNo = 1, pageSize = 10, flag) {
        return this.request({
          url: "/mini/miniRent/list",
          method: "get",
          data: {
            pageNo,
            pageSize,
            flag,
          },
        });
    }

    //获取房屋信息的列表
    houseList(commId, buildingId) {
        let obj = {}
        if(commId)  obj.commId = commId
        if(buildingId)  obj.buildingId = buildingId
        return this.request({
          url: "/mini/house/rentHouseList",
          data: obj,
        });
    }

    getById(id) {
        return this.request({
            url: '/app/rent/getById',
            data: {
                id
            }
        })
    }

    delete(id,flag = 2) {
        return this.request({
            url:'/app/rent/del',
            method:'post',
            data:{
                id,
                flag
            }
        })
    }
}

export {
    Renter
}
